package cn.tedu._07vehicle.controller;

import cn.tedu._07vehicle.base.response.Result;
import cn.tedu._07vehicle.base.response.StatusCode;
import cn.tedu._07vehicle.mapper.NoticeMapper;
import cn.tedu._07vehicle.pojo.vo.NoticeListVO;
import cn.tedu._07vehicle.pojo.vo.UserVO;
import cn.tedu._07vehicle.pojo.vo.VehicleListVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author tune_the last
 * @date 2025/11/14 - 16:05
 */
@Tag(name = "公告管理模块")
@RequestMapping("/v1/notice")
@RestController
public class NoticeController {
    @Autowired
    private NoticeMapper noticeMapper;


    @GetMapping("/list")
    @ApiOperationSupport(order = 10)
    @Operation(summary = "查询最新10条公告")
    public Result listNotice(/*HttpSession session*/){
//        UserVO userVO = (UserVO) session.getAttribute("user");
//        if (userVO == null){
//            return Result.fail(StatusCode.NOT_LOGIN);
//        }
        List<NoticeListVO> list = noticeMapper.selectNotice();
        return Result.ok(list);
    }
}
